package com.hackerrank.www.datastructures;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

import static java.lang.Math.abs;

/**
 * Created by 27340 on 2017/5/6.
 */
public class LeftRotation {
    static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer tok = null;
    public static void main(String[] args){
        int n = getInt();
        int d = getInt();
        int[] array = new int[n];
        int[] arrayCopy = new int[n];
        for(int i=0;i<n;i++){
            array[i] = getInt();
        }
        for(int i=n-1;i>=0;i--){
            if((i-d )<0){
                arrayCopy[n+i-d]=array[i];
            }else{
                arrayCopy[i-d] =array[i];
            }
        }
        for(int i=0;i<n;i++){
            System.out.print(arrayCopy[i]+" ");
        }
    }
    static String gets() throws IOException {
        if(tok == null || !tok.hasMoreTokens())
            tok = new StringTokenizer(br.readLine());
        return tok.nextToken();
    }

    static int getInt() {
        try {
            return Integer.parseInt(gets());
        } catch(IOException | NumberFormatException e) {
            return -1;
        }
    }
}
